------------------ fgui require start ------------------
------------------  fgui require end  ------------------
local GuildSettingEnterSkin = Class("GuildSettingEnterSkin");

function GuildSettingEnterSkin:ctor(com)
    ------------------ fgui事件绑定start ------------------
    self:bindChild(com);
    self.btn_blackbackground.onClick:Add(self.onTouch_Btn_blackbackground,self);
    self.btn_membershipapplication.onClick:Add(self.onTouch_Btn_membershipapplication,self);
    self.btn_amendmentnotice.onClick:Add(self.onTouch_Btn_amendmentnotice,self);
    self.btn_Informationsettings.onClick:Add(self.onTouch_Btn_Informationsettings,self);
    self.btn_quittheguild.onClick:Add(self.onTouch_Btn_quittheguild,self);
    self:init();
    ------------------  fgui事件绑定end  ------------------
end

function GuildSettingEnterSkin:bindChild(com)
    ------------------ fgui变量绑定start ------------------
    self.fguiObj = com;
    self.btn_blackbackground = com:GetChild("Btn_blackbackground");
    self.btn_membershipapplication = com:GetChild("Btn_membershipapplication");
    self.btn_amendmentnotice = com:GetChild("Btn_amendmentnotice");
    self.btn_Informationsettings = com:GetChild("Btn_Informationsettings");
    self.btn_quittheguild = com:GetChild("Btn_quittheguild");
    self.text_close = com:GetChild("Text_close");
    ------------------  fgui变量绑定end  ------------------
end

function GuildSettingEnterSkin:init() 
    self.touchClassifyCallback = nil;
    self.btn_membershipapplication.text = getLanguage("GuildInvestment_1059");
    self.btn_amendmentnotice.text = getLanguage("GuildInvestment_1060");
    self.btn_Informationsettings.text = getLanguage("GuildInvestment_1061");
    self.btn_quittheguild.text = getLanguage("GuildInvestment_1062");
    self:updateView();
end

function GuildSettingEnterSkin:OnDestroy()
    ------------------ fgui事件移除start ------------------
    self:beforeDestroy();
    self.btn_blackbackground.onClick:Clear();
    self.btn_membershipapplication.onClick:Clear();
    self.btn_amendmentnotice.onClick:Clear();
    self.btn_Informationsettings.onClick:Clear();
    self.btn_quittheguild.onClick:Clear();
    ------------------  fgui事件移除end  ------------------
end

function GuildSettingEnterSkin:onTouch_Btn_blackbackground(obj) end

function GuildSettingEnterSkin:onTouch_Btn_membershipapplication(obj) 
    self:exeClassifyCallback(1);
end

function GuildSettingEnterSkin:onTouch_Btn_amendmentnotice(obj) 
    self:exeClassifyCallback(2);
end

function GuildSettingEnterSkin:onTouch_Btn_Informationsettings(obj) 
    self:exeClassifyCallback(3);
end

function GuildSettingEnterSkin:onTouch_Btn_quittheguild(obj)
    if not logicMgr.GuildManager.canQuitGuild() then 
        UISysTips.AddMsg(getLanguage("GuildInvestment_1075"));           
    else
        local key = logicMgr.GuildManager.isChairman() and "45" or "40";
        local pop = CtrlManager.GetCtrl(PanelNames.UICommonPop);
        pop.Init(key, function(b)
            if b then
                self:exeClassifyCallback(4);
            end
        end);
    end
end

------------------  ↑ fgui事件句柄 ↑  ------------------

function GuildSettingEnterSkin:setCloseCallback(func,target)
    self.btn_blackbackground.onClick:Add(func,target);
end

function GuildSettingEnterSkin:setClassifyCallback(func,target)
    self.touchClassifyCallback = func;
end

function GuildSettingEnterSkin:exeClassifyCallback(classify)
    if self.touchClassifyCallback then self.touchClassifyCallback(classify) end
end

function GuildSettingEnterSkin:updateView()
    local selfPlayerId = logicMgr.HeroManager.GetRoleInfo().playerId;
    local selfTitleCfg = logicMgr.GuildManager.getUnionTitleCfgByPlayerId(selfPlayerId);
    if selfTitleCfg then
        self.btn_membershipapplication.visible = selfTitleCfg.f_Approval == 1;
        self.btn_amendmentnotice.visible = selfTitleCfg.f_Notice == 1;
        self.btn_Informationsettings.visible = selfTitleCfg.f_Guildname == 1;
    end
end

function GuildSettingEnterSkin:beforeDestroy() end

return GuildSettingEnterSkin;
